static inline void conditional_sti(struct pt_regs *regs)
{
- if ((uint8_t)(regs->xcs >> 16) == 0)
+ if (regs->eflags & (X86_EFLAGS_IF|VM_MASK))
local_irq_enable();
}
if (notify_die(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
SIGSEGV) == NOTIFY_STOP)
return;
-
/* It's safe to allow irq's after cr2 has been saved */
- if ((uint8_t)(regs->xcs >> 16) == 0)
+ if (regs->eflags & (X86_EFLAGS_IF|VM_MASK))
local_irq_enable();
tsk = current;
static inline void conditional_sti(struct pt_regs *regs)
{
- if ((uint8_t)(regs->cs >> 32) == 0)
+ if (regs->eflags & X86_EFLAGS_IF)
local_irq_enable();
}
SIGSEGV) == NOTIFY_STOP)
return;
- if (likely((uint8_t)(regs->cs >> 32) == 0))
+ if (likely(regs->eflags & X86_EFLAGS_IF))
local_irq_enable();
if (unlikely(page_fault_trace))
regs->rip = stu.rip;
regs->cs = stu.cs | 3; /* force guest privilege */
- regs->rflags = stu.rflags;
+ regs->rflags = (stu.rflags & ~(EF_IOPL|EF_VM)) | EF_IE;
regs->rsp = stu.rsp;
regs->ss = stu.ss | 3; /* force guest privilege */
* By this time, all the setups in the VMCS must be complete.
*/
.if \launch
- /* VMLUANCH */
+ /* VMLAUNCH */
.byte 0x0f,0x01,0xc2
pushf
call vm_launch_fail
shll $16,%eax # Bits 16-23: saved_upcall_mask
movw UREGS_cs+4(%esp),%ax # Bits 0-15: CS
FLT15: movl %eax,%gs:4(%esi)
+ test $0x00FF0000,%eax # Bits 16-23: saved_upcall_mask
+ setz %ch # %ch == !saved_upcall_mask
movl UREGS_eflags+4(%esp),%eax
+ andl $~X86_EFLAGS_IF,%eax
+ shlb $1,%ch # Bit 9 (EFLAGS.IF)
+ orb %ch,%ah # Fold EFLAGS.IF into %eax
FLT16: movl %eax,%gs:8(%esi)
test $TBF_EXCEPTION_ERRCODE,%cl
jz 1f
FLT2: movq %rax,32(%rsi) # SS
movq UREGS_rsp+8(%rsp),%rax
FLT3: movq %rax,24(%rsi) # RSP
- movq UREGS_eflags+8(%rsp),%rax
-FLT4: movq %rax,16(%rsi) # RFLAGS
movq VCPU_vcpu_info(%rbx),%rax
pushq VCPUINFO_upcall_mask(%rax)
testb $TBF_INTERRUPT,%cl
popq %rax
shlq $32,%rax # Bits 32-39: saved_upcall_mask
movw UREGS_cs+8(%rsp),%ax # Bits 0-15: CS
-FLT5: movq %rax,8(%rsi) # CS/saved_upcall_mask
+FLT4: movq %rax,8(%rsi) # CS / saved_upcall_mask
+ shrq $32,%rax
+ testb $0xFF,%al # Bits 0-7: saved_upcall_mask
+ setz %ch # %ch == !saved_upcall_mask
+ movq UREGS_eflags+8(%rsp),%rax
+ andq $~X86_EFLAGS_IF,%rax
+ shlb $1,%ch # Bit 9 (EFLAGS.IF)
+ orb %ch,%ah # Fold EFLAGS.IF into %eax
+FLT5: movq %rax,16(%rsi) # RFLAGS
movq UREGS_rip+8(%rsp),%rax
FLT6: movq %rax,(%rsi) # RIP
testb $TBF_EXCEPTION_ERRCODE,%cl
uint16_t cs;
uint8_t saved_upcall_mask;
uint8_t _pad0;
- uint32_t eflags;
+ uint32_t eflags; /* eflags.IF == !saved_upcall_mask */
uint32_t esp;
uint16_t ss, _pad1;
uint16_t es, _pad2;
uint16_t cs, _pad0[1];
uint8_t saved_upcall_mask;
uint8_t _pad1[3];
- __DECL_REG(flags);
+ __DECL_REG(flags); /* rflags.IF == !saved_upcall_mask */
__DECL_REG(sp);
uint16_t ss, _pad2[3];
uint16_t es, _pad3[3];